﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

//1.链表结点类型定义；
struct LinkNode
{
	int data;
	struct LinkNode* next;
};
void testLinkedList()
{
	struct LinkNode node1 = { 10,NULL };
	struct LinkNode node2 = { 20,NULL };
	struct LinkNode node3 = { 30,NULL };
	struct LinkNode node4 = { 40,NULL };
	struct LinkNode node5 = { 50,NULL };
	struct LinkNode node6 = { 60,NULL };

	node1.next = &node2;
	node2.next = &node3;
	node3.next = &node4;
	node4.next = &node5;
	node5.next = &node6;

	//2.遍历整个链表；先定义一个辅助指针变量pCurrent；
	struct LinkNode* pCurrent = &node1;
	while (pCurrent != NULL)
	{
		printf("3.输出链表中的结点的值data为：%d\n", pCurrent->data);//10，...，60

		//4.辅助指针pCurrent移动到下一个元素的首地址；
		pCurrent = pCurrent->next;
	}
}

//main214：静态链表
int main214()
{
	testLinkedList();

	system("pause");
	return EXIT_SUCCESS;
}